package ll;

import java.util.ArrayList;
import java.util.List;

public class SalarySystem {
    public static void main(String[] args) {
        // 模拟员工数据
        List<Employee> employees = new ArrayList<>();
        employees.add(new Employee("EMP001", "张三", 8000, 2000, 500));
        employees.add(new Employee("EMP002", "李四", 10000, 3000, 600));

        SalaryCalculator calculator = new SalaryCalculator();
        int currentWorkDays = 22;  // 当月应出勤天数

        for (Employee emp : employees) {
            // 设置员工出勤天数（示例数据）
            emp.setAttendanceDays(currentWorkDays);

            // 计算各项薪资
            double grossSalary = calculator.calculateGrossSalary(emp, currentWorkDays);
            double housingFund = calculator.calculateHousingFund(emp.getBaseSalary());
            double totalDeduction = emp.getSocialInsurance() + housingFund;
            double netSalary = calculator.calculateNetSalary(grossSalary, totalDeduction);

            // 输出薪资单
            System.out.println("============= 薪资单 ===============");
            System.out.println("员工编号：" + emp.getEmployeeId());
            System.out.println("员工姓名：" + emp.getName());
            System.out.println("应发工资：¥" + String.format("%.2f", grossSalary));
            System.out.println("社保扣除：¥" + String.format("%.2f", emp.getSocialInsurance()));
            System.out.println("公积金扣除：¥" + String.format("%.2f", housingFund));
            System.out.println("实发工资：¥" + String.format("%.2f", netSalary));
            System.out.println("====================================");
        }
    }
}
